<template>
    <div class="left">
        <div>左</div>
        <div>
            <div>父组件利用props传值,子组件获取:</div>
            <h3>inputOneP:利用搜索按钮来改变值</h3>
            inputOneP=={{ inputOneP }}
            <h3>valueTimeP:利用时间框值变化改变值</h3>
            valueTimeP== {{ valueTimeP }}
            <div>---------------------------------------------------------</div>
            <h3>
                利用公交中线BUS接收给兄弟组件参数
            </h3>
            <div>
                info:{{ info }}
            </div>
        </div>
    </div>
</template>

<script>
import Bus from "@/untils/bus";
export default {
    data() {
        return {
            info: {}
        }
    },
    props: ['inputOneP', 'valueTimeP'],
    //移除
    beforeDestroy() {
        Bus.$off('setListInfo');
    },
    watch: {
        inputOneP: {
            handler(newL, oldL) {
                if (newL) {
                    // alert("inputOneP值变化了")
                }
            },
            immediate: true,
        },
        valueTimeP: {
            handler(newL, oldL) {
                if (newL || newL == null) {
                    // alert("valueTimeP值变化了")
                    console.log("newL===", newL);

                }
            },
            immediate: true,
        }
    },
    activated() { },
    created() {
        // 获取兄弟组件传来的值
        Bus.$on("setListInfo", (info) => {
            console.log("info", info);
            this.info = info
        })
    },
    methods: {
    },
    mounted() { }
}
</script>

<style lang='scss' scoped>
.left {
    /* width: 500px; */
    height: 100%;
    // min-width: 500px;
    // max-width: 800px;
    width: 100%;
    border: none !important;
}
</style>